package com.tempjob.common.businesss.mongo.entity;

import com.anwen.mongo.annotation.ID;
import com.anwen.mongo.annotation.collection.CollectionField;
import com.anwen.mongo.annotation.collection.CollectionName;
import com.anwen.mongo.enums.FieldFill;
import com.anwen.mongo.enums.IdTypeEnum;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.data.annotation.Version;

import java.io.Serializable;
import java.util.Date;

/**
 * 用户操作日志
 * @TableName user_action_log
 */
@CollectionName(value ="user_action_log")
@Data
public class UserActionLog implements Serializable {
    /**
     *
     */
    @ID(type = IdTypeEnum.OBJECT_ID)
    @CollectionField("_id")
    @ApiModelProperty("id")
    private String id;

    /**
     * 用户id
     */
    @CollectionField(value = "user_id")
    private String userId;

    /**
     * 姓名
     */
    @CollectionField(value = "name")
    private String name;

    /**
     * 手机号
     */
    @CollectionField(value = "mobile")
    private String mobile;

    /**
     * token
     */
    @CollectionField(value = "token")
    private String token;

    /**
     * 用户操作
     */
    @CollectionField(value = "operation")
    private String operation;

    /**
     * 响应时间
     */
    @CollectionField(value = "time")
    private Integer time;

    /**
     * 请求方法
     */
    @CollectionField(value = "method")
    private String method;

    /**
     * url
     */
    @CollectionField(value = "url")
    private String url;

    /**
     * 请求参数
     */
    @CollectionField(value = "params")
    private String params;

    /**
     * 响应结果
     */
    @CollectionField(value = "response")
    private String response;

    /**
     * IP地址
     */
    @CollectionField(value = "ip")
    private String ip;

    @CollectionField(value = "oper_time",fill = FieldFill.INSERT_UPDATE)
    @ApiModelProperty(value = "更新时间",hidden = true)
    private Date operTime;

    @CollectionField(value = "oper_id",fill = FieldFill.INSERT_UPDATE)
    @ApiModelProperty(value = "更新人id",hidden = true)
    private Long operId;

    @CollectionField(value = "oper_name",fill = FieldFill.INSERT_UPDATE)
    @ApiModelProperty(value = "更新人",hidden = true)
    private String operName;

    @CollectionField(value = "create_id",fill = FieldFill.INSERT)
    @ApiModelProperty(value = "创建人id",hidden = true)
    private Long createId;

    @CollectionField(value = "create_name",fill = FieldFill.INSERT)
    @ApiModelProperty(value = "创建人",hidden = true)
    private String createName;

    @CollectionField(value = "create_time",fill = FieldFill.INSERT)
    @ApiModelProperty(value = "创建时间",hidden = true)
    private Date createTime;

    @Version
    @CollectionField("version")
    @ApiModelProperty(value = "乐观锁", hidden = true)
    private Integer version;

    @CollectionField(exist = false)
    private static final long serialVersionUID = 1L;
}
